#include <iostream>
#include <vector>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> statements(N);
    for (int i = 0; i < N; ++i) {
        cin >> statements[i];
    }

    for (int i = 1; i <= N; ++i) {
        for (int j = i + 1; j <= N; ++j) {
            int lyingCount = 0;
            vector<bool> isWolf(N + 1, false);
            isWolf[i] = isWolf[j] = true;

            for (int k = 0; k < N; ++k) {
                if ((statements[k] > 0 && isWolf[abs(statements[k])]) || (statements[k] < 0 &&!isWolf[abs(statements[k])])) {
                    ++lyingCount;
                }
            }

            if (lyingCount == 2) {
                bool hasWolfLying = false;
                for (int k = 0; k < N; ++k) {
                    if ((isWolf[k + 1]) && ((statements[k] > 0 && isWolf[abs(statements[k])]) || (statements[k] < 0 &&!isWolf[abs(statements[k])]))) {
                        hasWolfLying = true;
                        break;
                    }
                }
                if (hasWolfLying) {
                    cout << i << " " << j << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No Solution" << endl;
    return 0;
}    